import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '/',
    redirect: '/home/order-add'
  },
  {
    path: '/user/login',
    name: '/user/login',
    component: () => import('../views/user/Login.vue')
  },
  {
    path: '/user/registry',
    name: '/user/registry',
    component: () => import('../views/user/Registry.vue')
  },
  {
    path: '/user/address',
    name: '/user/address',
    component: () => import('../views/user/Address.vue')
  },
  {
    path: '/user/address-add',
    name: '/user/address-add',
    component: () => import('../views/user/AddressAddNew')
  },
  {
    path: '/user/address-update',
    name: '/user/address-update',
    component: () => import('../views/user/AddressUpdate')
  },
  {
    path: '/user/details',
    name: '/user/details',
    component: () => import('../views/user/UserDetails')
  },
  {
    path: '/user/feedback',
    name: '/user/feedback',
    component: () => import('../views/user/Feedback')
  },
  {
    path: '/order/payment',
    name: '/order/payment',
    component: () => import('../views/order/OrderPayment')
  },
  {
    path: '/order/details',
    name: '/order/details',
    component: () => import('../views/order/OrderDetails')
  },
  {
    path: '/order/update-address',
    name: '/order/update-address',
    component: () => import('../views/order/UpdateAddress')
  },
  {
    path: '/order/evaluate',
    name: '/order/evaluate',
    component: () => import('../views/order/OrderEvaluate')
  },
  {
    path: '/evaluate/list',
    name: '/evaluate/list',
    component: () => import('../views/evaluate/OrderEvaluateList')
  },
  {
    path: '/home',
    name: '/home',
    component: () => import('../views/HomeView.vue'),
    children: [
      {
        path: 'order-add',
        component: () => import('../views/home/OrderAddNewView'),
      },
      {
        path: 'order-list',
        component: () => import('../views/home/OrderListView'),
      },
      {
        path: 'platform',
        component: () => import('../views/home/UserPlatformView.vue'),
      },
    ]
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  scrollBehavior(to, from, savedPosition) {
    return { x: 0, y: 0}
  },
})

export default router
